<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDeviceGroupTasksTable extends Migration
{
  /**
   * Run the migrations.
   *
   * @return void
   */
  public function up()
  {
    Schema::create('device_group_tasks', function (Blueprint $table) {
      $table->increments('id');
      $table->integer('device_group_id')->index()->nullable()->comment('设备分组ID');
      $table->timestamp('publish_start_time')->comment('发布开始时间');
      $table->timestamp('publish_end_time')->comment('发布结束时间');
      $table->integer('task_id')->index()->comment('任务ID');
      $table->integer('priority')->index()->comment('优先级，值越大优先级越高');
      $table->timestamps();
    });
  }

  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
    Schema::dropIfExists('device_group_tasks');
  }
}
